package com.hq.shcrm.service.impl;

import com.hq.shcrm.mapper.CourseOrderMapper;
import com.hq.shcrm.pojo.CourseOrder;
import com.hq.shcrm.pojo.PageResult;
import com.hq.shcrm.service.ICourseOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @author:huangqing
 * @create:2020-04-12-19:29
 */
@Service
public class iCourseOrderServiceImpl implements ICourseOrderService {

    @Autowired
    CourseOrderMapper orderMapper;

    @Override
    public PageResult<CourseOrder> findPageResult(CourseOrder condition, int page, int pageSize) {

        //定义一个Map-参数先不放在map,后面再处理
        Map<String,Object> params = new HashMap<>();
        params.put("start",(page-1)*pageSize);
        params.put("limit",pageSize);

        //定义结果
        PageResult<CourseOrder> result = new PageResult<>();

        result.setCount(orderMapper.findCountByMap(params));
        result.setData(orderMapper.findListByMap(params));
        return result;
    }

}
